//
//  bunkViewCell.m
//  SSSAllRollAgency
//
//  Created by Darker on 2017/3/15.
//  Copyright © 2017年 Darker. All rights reserved.
//

#import "bunkViewCell.h"
#import "myBunkCardModel.h"

@implementation bunkViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = [UIColor colorWithHex:@"FFFFFF"];
        [self setUpSubViews];
    }
    return self;
}
- (void)setUpSubViews{
    
    _lineView = [[UIView alloc]init];
    [self addSubview:_lineView];
    _lineView.backgroundColor = [UIColor colorWithHex:@"E5E5E8"];
    _lineView.sd_layout
    .bottomEqualToView(self)
    .leftEqualToView(self)
    .rightEqualToView(self)
    .heightIs(0.5);
    
    _nameLabel = [[UILabel alloc]init];
    _nameLabel.textColor = [UIColor colorWithHex:@"6D6D6D"];
    _nameLabel.text = @"华夏银行";
    _nameLabel.textAlignment = NSTextAlignmentLeft;
    _nameLabel.font = [SSSFont systemFontOfSize:15];
    [self addSubview:_nameLabel];
//    _nameLabel.sd_layout
//    .leftSpaceToView(self,WidthIos6CompeteWithCurrent(15))
//    .centerYEqualToView(self)
//    .widthIs([ZDKitManager zd_AutoSizeOfWidthWithText:_nameLabel.text font:[SSSFont systemFontOfSize:15] height:HeigthIos6CompeteWithCurrent(35)])
//    .heightIs(HeigthIos6CompeteWithCurrent(35));
    
//    //箭头
//    UIButton *arowBtn = [[UIButton alloc]init];
//    [arowBtn setBackgroundImage:[UIImage imageNamed:@"icon_arrow_right"] forState:UIControlStateNormal];
//    [self addSubview:arowBtn];
//    arowBtn.sd_layout
//    .centerYEqualToView(self)
//    .rightSpaceToView(self,WidthIos6CompeteWithCurrent(15))
//    .widthIs(WidthIos6CompeteWithCurrent(8))
//    .heightIs(HeigthIos6CompeteWithCurrent(14));
    
    _subTitle = [[UILabel alloc]init];
    _subTitle.textColor = [UIColor colorWithHex:@"BBBBBB" alpha:0.3];
    _subTitle.textAlignment = NSTextAlignmentRight;
    _subTitle.text = @"(尾号:3845)";
    _subTitle.font = [SSSFont systemFontOfSize:15];
    [self addSubview:_subTitle];
//    _subTitle.sd_layout
//    .leftSpaceToView(_nameLabel,WidthIos6CompeteWithCurrent(5))
//    .centerYEqualToView(self)
//    .heightIs(HeigthIos6CompeteWithCurrent(40))
//    .widthIs([ZDKitManager zd_AutoSizeOfWidthWithText:_subTitle.text font:[SSSFont systemFontOfSize:15] height:HeigthIos6CompeteWithCurrent(40)]);
    
}
- (void)setMyBunkModel:(myBunkCardModel *)myBunkModel{
    
    _myBunkModel = myBunkModel;
    
    _nameLabel.text = myBunkModel.bankName;
    _nameLabel.sd_layout
    .leftSpaceToView(self,WidthIos6CompeteWithCurrent(15))
    .centerYEqualToView(self)
    .widthIs([ZDKitManager zd_AutoSizeOfWidthWithText:_nameLabel.text font:[SSSFont systemFontOfSize:15] height:HeigthIos6CompeteWithCurrent(35)])
    .heightIs(HeigthIos6CompeteWithCurrent(35));
    NSString *bunkString = [myBunkModel.bankCardNo substringWithRange:NSMakeRange(myBunkModel.bankCardNo.length - 4, 4)];
    _subTitle.text =  [NSString stringWithFormat:@"%@",[NSString stringWithFormat:@"(尾号:%@)",bunkString]];
    _subTitle.sd_layout
    .leftSpaceToView(_nameLabel,WidthIos6CompeteWithCurrent(5))
    .centerYEqualToView(self)
    .heightIs(HeigthIos6CompeteWithCurrent(40))
    .widthIs([ZDKitManager zd_AutoSizeOfWidthWithText:_subTitle.text font:[SSSFont systemFontOfSize:15] height:HeigthIos6CompeteWithCurrent(40)]);
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
